1. Field of the Invention
The present invention relates to an apparatus and a method for detecting a subject from an image. More particularly, the present invention relates to a technique suitable for detecting a moving object, for example.
2. Description of the Related Art
An example of a technique to detect an object in an image captured by a camera is to detect a moving object based on a background difference method. In the background difference method, a background image that does not contain a subject is captured in advance with a fixed camera, and a feature quantity of the captured image is stored as a standard model. Then, a difference between the feature quantity in an image input from the camera and the feature quantity in the standard model is calculated. Areas in the input image that have a large difference are detected as a foreground (moving object).
Further, in the background difference method, to respond to changes in the background, processing is performed that deletes (forgets) from the standard model features that have not appeared for some time. Consequently, detection of the foreground area can be performed accurately.
Another technique is to detect a specific subject, such as a face or a person, from the image. In this method, a detection window having a predetermined size is scanned in an input image. A pattern image is cut out from the image in the detection window, and this pattern image is subjected to a two-class determination regarding whether it is a subject or not.
In this determination, a determination device is configured by using adaptive boosting to effectively combine many weak determination devices in order to improve the determination accuracy. Further, these determination devices are connected in series to form a cascade-type detection device. The weak determination devices are configured based on a Haar-type rectangular feature quantity.
The cascade-type detection device deletes pattern candidates that are clearly not subjects by using a simple preliminary-stage detection device. Determination is then performed on only the remaining candidates regarding whether they are subjects by using a complex advanced-stage determination device that has a superior identification performance.
For example, Japanese Patent Application Laid-Open No. 2002-74371 discusses a technique in which subject (person) identification is performed only on areas determined to be a moving object area obtained based on a background difference. Generally, since subject detection is performed by scanning a detection window in an image, and then each time using a plurality of determination devices, the processing costs become very expensive. Therefore, by performing subject detection only on the moving object areas that are detected based on a background difference as described above, the overall processing costs can be reduced as compared with performing such processing on all areas in the image.
However, in a place such as awaiting room, for example, when detecting a person as the subject, the person will often move around after stopping for a predetermined time. FIG. 16 illustrates frame images 101 to 103 showing such a case, and detection results 104 to 106 for the conventional background difference obtained at this time. Further, an area 107 is a person area, and areas 108 and 109 are detected as a foreground. Time flows from left to right.
In FIG. 16, while the person 107 is stopped (frame images 101 and 102), if a predetermined time elapses, the feature quantity of the background hidden by the person 107 is forgotten from the standard model. When the I/O device 107 moves, not only the area 108 corresponding to the person, but the background that has reappeared is also detected as a new foreground area 109 because a difference occurs when compared with the standard model.
Each time this situation occurs like in the technique discussed in Japanese Patent Application Laid-Open No. 2002-74371, if such a event has occurred, the foreground areas becomes wide even if the subject detection and search range is narrowed based on a background difference. More specifically, the subject detection search range cannot be appropriately narrowed, which makes it impossible to perform rapid subject detection.